{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=2966
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
const
	INF = round(1e9);
 
var  	
	i, j, n, m, nn, mm, ls : longint;
	a, f : array[0..110, 0..110] of longint;
	s : string;
 
begin
	reset(input,'input.txt');
	rewrite(output,'output.txt');
	read(n, m);
	for i := 1 to n do 
		for j := 1 to m do
			read(a[i][j]);
	nn := n + 1;
	mm := m + 1;
	for i := 0 to nn do
		for j := 0 to mm do
			f[i][j] := -INF;
	f[0][1] := 0;
	for i := 1 to n do
		for j := 1 to m do
			f[i][j] := max(f[i - 1][j], f[i][j - 1]) + a[i][j];
	f[0][1] := -INF;
	writeln(f[n][m]);
	s := '';
	i := n;
	j := m;
	while (i >= 1) and (j >= 1) do
		if f[i - 1][j] > f[i][j - 1] then begin
			s := 'D' + s;
			dec(i);
		end else begin
			s := 'R' + s;
			dec(j);
		end;
	ls := n + m - 1;
	for i := 2 to ls do
		write(s[i], ' ');
end.